package com.filyar.htyd.exception;

import com.filyar.htyd.common.ExceptionEnum;
import lombok.Getter;

/**
 * 自定义异常
 */
@Getter
public class ServiceException extends RuntimeException {
    private final String code;
    private final Boolean needToSend;


    public ServiceException(String code, String msg, Boolean needToSend) {
        super(msg);
        this.code = code;
        this.needToSend = needToSend;
    }

    public ServiceException(ExceptionEnum exceptionEnum){
        super(exceptionEnum.getMsg());
        this.code = exceptionEnum.getCode();
        this.needToSend = exceptionEnum.getNeedToSend();
    }

}
